// run: $exec < input
#include <iostream>

int n;

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n;
	int max = 0, second = 0, id;
	for (int i = 0, x; i < n; i++) {
		std::cin >> x;
		if (x > max) {
			second = max;
			max = x;
			id = i + 1;
		} else if (x > second) {
			second = x;
		}
	}
	std::cout << id << " " << second << "\n";
}

